Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement proper timers for the index/sync command #2762

Merged
merged 1 commit into from
May 13, 2022

Conversation

felipeelia
Copy link
Member

Description of the Change

As stated in this comment, the times displayed by the WP-CLI sync/index command are currently wrong. That is happening because the code relies on WP's timer_start() but that does not work with nested calls: as Indexable is also calling that function, the timer resets for every batch of documents.

The PR introduces a timer_* collection of functions, inspired a bit by what WP core has in its wpdb class.

Changelog Entry

Fixed: "Time elapsed" and "Total time elapsed" in WP-CLI index command.

Credits

Props @felipeelia @archon810

@felipeelia felipeelia added this to the 4.2.0 milestone May 13, 2022
@felipeelia felipeelia self-assigned this May 13, 2022
Copy link
Contributor

@tott tott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me

@felipeelia felipeelia merged commit b2de6e6 into develop May 13, 2022
@felipeelia felipeelia deleted the fix/wp-cli-timers branch May 13, 2022 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants